package com.itheima.tliasproject.pojo;


import lombok.Data;

@Data
//统一响应结果
public class Result {
    private Integer code;
    private String msg;
    private Object data;


    //这个方法是返回没有数据的情况
    public static Result Success(){
        Result result = new Result();
        result.code = 1;
        result.msg = "success";
        return result;
    }

    //带有返回数据的情况
    public static Result Success(Object object){
        Result result = new Result();
        result.code = 1;
        result.msg = "success";
        result.data = object;
        return result;
    }
    //请求失败的情况
    public static Result error(String msg){
        Result result = new Result();
        result.code = 0;
        result.msg = "error";
        result.msg = msg;
        return result;
    }
}
